<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>更多操作</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/static/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/admin.css" media="all">
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">

        <div class="layui-col-md4">
            <div class="layui-card">
                <div class="layui-card-header">操作: #(merch.code)-#(merch.name) </div>
            </div>

            <div class="layui-card">
                <div class="layui-card-header">编辑 <button class="layui-btn layuiadmin-btn-list" onclick="editjs()" id="p_todo">编辑</button></div>
            </div>

            <div class="layui-card">
                <div class="layui-card-header">上传文件 <a lay-href="admin/merch/uploadmerch?code=#(merch.code)" id="pp_todo">上传</a></div>
            </div>

            <div class="layui-card">
                <div class="layui-card-header">收款人管理<button class="layui-btn layuiadmin-btn-list" onclick="cardjs()" id=cc_todo">添加</button></div>
            </div>


            <!--<div class="layui-card">-->
                <!--<div class="layui-card-header">下载 <button class="layui-btn layuiadmin-btn-list" onclick="downjs()" id="c_todo">下载</button></div>-->
            <!--</div>-->


            <div class="layui-card">
                <div class="layui-card-header">删除 <button class="layui-btn layuiadmin-btn-list" onclick="delectjs()" id="d_todo">删除</button></div>
            </div>
        </div>

    </div>
</div>

<script src="/static/layui/layui.js"></script>
<script>
    layui.config({
        base: '../../' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'console'], function(){
        var $ = layui.$;

    });

    function cardjs(){
        var iid = #(merch.id);
		parent.layer.open({
            type : 2,
            title : "添加充值银联卡",
            content : layui.setter.base + "admin/merch/addCardPage?id=" + iid,
            maxmin : !0,
            area : [ '600px', '500px' ],
            btn : [ "确定", "取消" ],
            yes : function(index, layero) {
                // 点击确认触发 iframe 内容中的按钮提交
                layero.find('iframe').contents().find(
                    "#layuiadmin-app-form-edit").click();
            }
        });
    }

    function downjs() {
        //alert("下载:" + "#(merch.code)" +"-" + "#(merch.name)");
        layer.confirm("确定下载吗？", function(e) {
            window.location.href = layui.setter.base + "admin/merch/downmerch?code="
                + #(merch.code) + "&r=" + Math.random();
            layer.close(e);
        });
    }

    function editjs() {
        var iid = #(merch.id);
		parent.layer.open({
            type : 2,
            title : "编辑商户",
            content : layui.setter.base + "admin/merch/updatePage?id=" + iid,
            maxmin : !0,
            area : [ '600px', '500px' ],
            btn : [ "确定", "取消" ],
            yes : function(index, layero) {
                // 点击确认触发 iframe 内容中的按钮提交
                layero.find('iframe').contents().find(
                    "#layuiadmin-app-form-edit").click();
            }
        });

    }

    function delectjs() {
        var iid =#(merch.id);
        layer.confirm("确定删除吗？", function(e) {
            // 请求删除接口
            layui.admin.req({
                url : layui.setter.base + "admin/merch/delete?id="
                    + iid + "&r=" + Math.random(),
                data : null,
                done : function(res) {
                    if (res.code !== 0) {
                        layer.msg(res.msg, {
                            icon : 2
                        });
                    } else {
                        layer.msg(res.msg, {
                            icon : 1
                        });
                        //layui.table.reload('LAY-web-list'); // 重载表格
                        layer.close(e); // 再执行关闭
                    }
                }
            });
        });
    }
</script>


</body>
</html>

